package com.heima.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.model.user.pojos.ApUser;
import com.heima.user.mapper.ApUserMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequiredArgsConstructor
public class UserClientController {

    private final ApUserMapper mapper;

    @PostMapping("/client/find")
    public String findUserName(String id){
        log.info("查询作者姓名");
        LambdaQueryWrapper<ApUser> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq(ApUser::getId,id);
        ApUser apUser = mapper.selectOne(lambdaQueryWrapper);
        return apUser.getName();
    }

}
